<script lang="ts" setup>
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
onLaunch(() => {
  console.log("App Launch");
  checkUserStatus()
});

onShow(() => {
  console.log("App Show");
  checkUserStatus()
});

onHide(() => {
  console.log("App Hide");
});

function checkUserStatus (){
  const token = uni.getStorageSync('userToken');
  console.log('token', token)
  if (!token) {
    uni.redirectTo({
      url: '/pages/login/index' // 目标页面的路径
    });
    // uni.redirectTo({
    //   url: '/pages/login/index' // 目标页面的路径
    // });
  }
}
</script>

<style lang="scss">
@import "nutui-uniapp/styles/index.scss";
@import '@/assets/css/custom_theme.scss';
</style>
<style>
/deep/.uni-toast{
  width: auto !important;
  padding: 0 20rpx !important;
}
/deep/.uni-toast__content{
  padding: 8rpx 0 4rpx 0  !important;
}
</style>
